/**
 * 
 */
package mycsveditor.editors;

/**
 * @author dongxu
 * 
 */
public class ParameterDescriptor {

	private String name;

	private String type;

	public ParameterDescriptor(String name, String type) {
		super();
		this.name = name;
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public String getType() {
		return type;
	}

	@Override
	public String toString() {
		if (null == type || "".equals(type)) {
			return name;
		}
		return String.format("%1$s(%2$s)", name, type);
	}
	
	@Override
	public boolean equals(Object o) {
		if (!(o instanceof ParameterDescriptor)) {
			return false;
		}
		ParameterDescriptor pd = (ParameterDescriptor) o;
		return name.equals(pd.getName());
	}
	
	@Override
	public int hashCode() {
		return name.hashCode();
	}
}
